<template>
  <div>
    <button @click="add_num(10)">+</button>
    {{num}}
    <hr>
    {{ $store.getters.doubleNum }}
    <button @click="reduce_num(5)">-</button>
    <button @click="fetch_num">异步赋值num</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
  mounted () {
    console.log(this.$store)
  },
  methods: {
    ...mapMutations(['add_num', 'reduce_num']),
    ...mapActions(['fetch_num'])
  },
  computed: {
    ...mapState(['num'])
  }
}
</script>

<style lang="scss" scoped>

</style>
